package com.sora.pipeline.domain.dto;

import jakarta.validation.constraints.*;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 巡检任务创建/更新请求DTO
 * 
 * @author system
 * @since 2025-01-20
 */
@Data
public class InspectionTaskRequest {
    
    /**
     * 任务名称
     */
    @NotBlank(message = "任务名称不能为空")
    @Size(min = 2, max = 50, message = "任务名称长度必须在2-50字符之间")
    private String name;
    
    /**
     * 计划ID
     */
    private Long planId;
    
    /**
     * 线路ID
     */
    @NotNull(message = "线路ID不能为空")
    private Long lineId;
    
    /**
     * 负责人ID
     */
    private Long assigneeId;
    
    /**
     * 巡检周期：daily/weekly/monthly/custom
     */
    @NotBlank(message = "巡检周期不能为空")
    @Pattern(regexp = "^(daily|weekly|monthly|custom)$", message = "巡检周期只能是daily/weekly/monthly/custom")
    private String cycle;
    
    /**
     * 状态：pending/in_progress/pending_receipt/completed/timeout/disabled
     */
    @Pattern(regexp = "^(pending|in_progress|pending_receipt|completed|timeout|disabled)$", 
             message = "状态只能是pending/in_progress/pending_receipt/completed/timeout/disabled")
    private String status;
    
    /**
     * 截止时间
     */
    private LocalDateTime deadline;
    
    /**
     * 开始时间
     */
    private LocalDateTime startTime;
    
    /**
     * 完成时间
     */
    private LocalDateTime completionTime;
    
    /**
     * 备注
     */
    @Size(max = 500, message = "备注长度不能超过500字符")
    private String remark;
    
    /**
     * 完成进度（0-100）
     */
    @Min(value = 0, message = "完成进度不能小于0")
    @Max(value = 100, message = "完成进度不能大于100")
    private Integer progress;
}
